//
//  GoodsListItemCell.m
//  share_business
//
//  Created by 吴于凌 on 2017/9/10.
//  Copyright © 2017年 wyl. All rights reserved.
//

#import "GoodsListItemCell.h"
#import "BSCommon.h"
@interface GoodsListItemCell ()

@property(nonatomic,strong)UIImageView *goodImageView ;
@property(nonatomic,strong)UILabel *tipImageView ;


@property(nonatomic,strong)UILabel *titleLabel ;
@property(nonatomic,strong)UILabel *detailLabel ;
@property(nonatomic,strong)UILabel *newestLabel ;
@property(nonatomic,strong)UILabel *oldLabel ;


@property(nonatomic,strong)UILabel *codeLabel ;//
@property(nonatomic,strong)UILabel *zekouLabel ;//
@property(nonatomic,strong)UILabel *shareValueLabel ;//

@end

@implementation GoodsListItemCell


-(void)setUpView {
    UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(10, 0, self.width - 20, self.height)];
    
    UIView *tipView = [[UIView alloc]init];
    _goodImageView = [BSWidget commonImageViewWithFrame:CGRectZero image:ImageNamed(nil)];
    
    _tipImageView = [BSWidget commonLableWithFrame:CGRectZero text:@"最高分值" color:nil font:13];

    _titleLabel = [BSWidget commonLableWithFrame:CGRectZero text:@"商品标题" color:nil font:15];
    _detailLabel= [BSWidget commonLableWithFrame:CGRectZero text:@"商品详情" color:nil font:15];
    _newestLabel=[BSWidget commonLableWithFrame:CGRectZero text:@"¥499" color:nil font:16];
    _oldLabel = [BSWidget commonLableWithFrame:CGRectZero text:@"预计分享值:200" color:nil font:13];
    
    _codeLabel = [BSWidget commonLableWithFrame:CGRectZero text:@"包邮" color:nil font:13];
    _zekouLabel = [BSWidget commonLableWithFrame:CGRectZero text:@"7天退" color:nil font:13];
    _shareValueLabel = [BSWidget commonLableWithFrame:CGRectZero text:@"24小时" color:nil font:13];
    
    
    _goodImageView.frame = CGRectMake(0, 0, bgView.width, 140);
    _tipImageView.frame = CGRectMake(5, 5, 15, 65);
    _tipImageView.numberOfLines = 4 ;
    _tipImageView.textColor =[UIColor whiteColor];
    _tipImageView.backgroundColor = [UIColor colorWithHexString:@"#808000"];
    
    tipView.frame = CGRectMake(0, _goodImageView.maxY, bgView.width, 40) ;
    tipView.backgroundColor = [UIColor colorWithHexString:@"#F5F5DC"];
    
    _codeLabel .frame = CGRectMake(0,0, 43, 20);
    _codeLabel .textColor = [UIColor colorWithHexString:@"#87865a"];
    _codeLabel.textAlignment =NSTextAlignmentCenter ;
    [_codeLabel setBorder:1 cornerRadius:4 color:[UIColor colorWithHexString:@"#87865a"]];
    _codeLabel.centerY = 20 ;
    
    _zekouLabel .frame = CGRectMake(_codeLabel.maxX+3, _codeLabel.y, 43, 20);
    _zekouLabel .textColor = [UIColor colorWithHexString:@"#87865a"];
    _zekouLabel.textAlignment =NSTextAlignmentCenter ;
    [_zekouLabel setBorder:1 cornerRadius:4 color:[UIColor colorWithHexString:@"#87865a"]];
    
    _shareValueLabel.frame = CGRectMake(_zekouLabel.maxX+3, _zekouLabel.y, 50, 20);
    _shareValueLabel .textColor = [UIColor colorWithHexString:@"#87865a"];
    _shareValueLabel.textAlignment =NSTextAlignmentCenter ;
    [_shareValueLabel setBorder:1 cornerRadius:4 color:[UIColor colorWithHexString:@"#87865a"]];
    
    
    _titleLabel.frame = CGRectMake(0, tipView.maxY, self.width /3, 30);
    _titleLabel.textColor = RGBA(51, 51, 51, 1);
    
    _detailLabel.frame = CGRectMake(_titleLabel.maxX, tipView.maxY, self.width * 2/3, 30);
    _detailLabel.textColor = RGBA(51, 51, 51, 1);
    
    _newestLabel.frame = CGRectMake(0, _titleLabel.maxY, self.width  /3, 30);
    _newestLabel.textColor = [UIColor orangeColor];
    
    _oldLabel.frame = CGRectMake(_newestLabel.maxX, _titleLabel.maxY, self.width *3, 30);
    _oldLabel.textColor = RGBA(51, 51, 51, 1);
    [self addSubview:bgView];
    [bgView addSubview:_goodImageView];
    [bgView addSubview:_tipImageView];
    [bgView addSubview:tipView];
    [tipView addSubview:_codeLabel];
    [tipView addSubview:_zekouLabel];
    [tipView addSubview:_shareValueLabel];
    
    [bgView addSubview:_titleLabel];
    [bgView addSubview:_detailLabel];
    [bgView addSubview:_newestLabel];
    [bgView addSubview:_oldLabel];
}
@end
